package com.lesson60.sshdemo;

import java.util.ArrayList;
import java.util.List;

public class CategoryController {
	public CategoryDAO mCategoryDAO;

	public CategoryDAO getmCategoryDAO() {
		return mCategoryDAO;
	}

	public void setmCategoryDAO(CategoryDAO mCategoryDAO) {
		this.mCategoryDAO = mCategoryDAO;
	}
	
	public void addCategory(Category category){
		mCategoryDAO.save(category);
	}
	
	public List<Category> getAll(){
		ArrayList<Category> mList = (ArrayList) mCategoryDAO.findAll();
		System.out.println(" size=" +mList.size());
		Category m = mList.get(2);
		System.out.println(" ============name=" + m.getCategoryname());
		return mList;
	}
	
	
}
